;(function(Ext,exports){
	
	var GridUtil={};
	
	GridUtil.getGridConfig=function(metaData){
		
	};
	
	GridUtil.getEditor=function(field,metaData){
		
	};
	
	GridUtil.getRenderer=function(field,metaData){
		
	};
	
	
	GridUtil.getEditorGridConfig=function(metaData){
		var columns=[],metaData["fields"],refEnumMap=metaData["refEnumMap"],
		refMetaMap=metaData["refMetaMap"];
		Ext.iterate(fs,function(f,i){
			var name=f["name"],text=f["name"],editor={xtype:"textfield"}
			column={dataIndex:name,text:text,editor:editor},type=f["type"],attrs=f["attrs"],
			enums=attrs["enums"],picker=attrs["picker"];
			
			if(enums){
				enums=enums.substring(enums.indexOf("$")+1);
				var enumdata=refEnumMap[enums];
				editor["xtype"]='combo';
				editor["queryMode"]='local';
				editor["valueField"]=attrs["valueField"]||"code";
				editor["displayField"]=attrs["displayField"]||"text";
				
				editor["forceSelection"]=attrs["forceSelection"]||false;
				editor["store"]={
					fields:["sid","name","code","text"],
					data:refEnumMap[enums]["list"]
				};
				editor["triggerAction"]="all";
			}else if(picker){
				
				editor["triggers"]={
						"trigger1":{
							handler:function(){
								var ctrl=this;
								Ext.create({
									valueHolder:ctrl,
									xtype:picker,
									modal:true
								}).show();
							}
						}
				};
			}else{
				switch(type){
				case 1:
					break;
				case 4:
				case -5:
					editor["xtype"]='numberfield';
					break;
				case 91:
					editor["xtype"]='datefield';
					editor["format"]='Y-m-d';
					break;
				case 92:
					editor["xtype"]='timefield';
					editor["format"]='h:i:s';
					break;
				case 93:
					editor["xtype"]='datefield';
					editor["format"]='Y-m-d h:i:s';
					break;
				}
			}
			columns.push(columns);
		});
		var gridConfig={
			xtype:"grid",
			requires: [
		        'Ext.selection.CellModel'
		    ],
			columns:columns,
			frame: true,
			selModel:{
			        type: 'cellmodel'
			},
			split:true,
			viewConfig: {
			        trackOver: false,
			        stripeRows: false,
			        enableTextSelection:true
			},
			 plugins: {
			        ptype: 'cellediting',
			        clicksToEdit: 1
			    },
			    
		};
		return gridConfig;
	};
	exports.GridUtil=GridUtil;
	
})(Ext,window);